﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MethodWorx.CMS.Plugins;
using MethodWorx.CMS.Services;
using System.Web.Mvc;
using MethodWorx.CMS.Content;
using MethodWorx.CMS.UI.Application.ActionResults;
using MethodWorx.CMS.Workflow.IfValid;

namespace MethodWorx.CMS.Workflow.IfEquals
{
    public class IfEqualsConfigurationController : WorkflowConfigurationController<IfEqualsConfiguration>
    {
        public IfEqualsConfigurationController(IdeExtension view, WorkflowService service)
            : base(view, service)
        {
        }

        protected override WorkflowConfigurationStep CreateNewWorkflowConfigurationStep(Guid id, string output)
        {
            Guid branchId = Guid.NewGuid();

            return new WorkflowConfigurationStep()
                        {
                            Id = id,
                            ComponentId = IfEqualsWorkflowComponent.ComponentId,
                            ComponentConfiguration = new IfEqualsConfiguration(),
                            Steps = new WorkflowConfigurationStep[]
                                        {
                                            new BranchStep("Equals", "Equals"),
                                            new BranchStep("Does Not Equals", "DoesNotEqual"),
                                        }
                        };
        }

        protected override void ReconfigureExistingStep(WorkflowConfigurationStep step, string output)
        {
            step.ComponentId = IfEqualsWorkflowComponent.ComponentId;
        }
    }
}
